import React from 'react';
import "../../../styles/Allocate/List/Create.scss"
import { Form, Button, Input, message } from 'antd'
import { useNavigate } from "react-router-dom";
import{Create_list}from "../../../utils/api"
import '../../../font_icon/iconfont.css'
interface Props {
}

function Create(props: Props) {
    var navigate = useNavigate();
    const onFinish = (values: any) => {
        console.log(values)
        //创建
        Create_list(values).then((res) => {
          console.log(res.data);
          if (res.request.status == 201) {
            message.open({ type: "success", content: "添加成功!" });
            navigate("/index/home/AllocateManagement");
          } else {
            message.open({ type: "error", content: "添加失败!" });
          }
        });
    };
    const onFinishFailed = (errorInfo: any) => {
        console.log("Failed:", errorInfo);
    };
    let cancel = function () {
        navigate("/index/home/AllocateManagement");
      };
    return (
        <div className='Create'>
            <div className='top'>仓储管理 / 出库管理 / 新建出库</div>
            <div className="table">
                <Form
                    name="basic"
                    labelCol={{ span: 6 }}
                    wrapperCol={{ span: 22 }}
                    initialValues={{ remember: true }}
                    onFinish={onFinish}
                    onFinishFailed={onFinishFailed}
                    autoComplete="off"
                >
                    <Form.Item label="调拨单号" name="tracking" className="lb">
                        <Input />
                    </Form.Item>
                    <Form.Item label="操作人员" name="people" className="lb">
                        <Input />
                    </Form.Item>
                    <Form.Item label="调出仓库" name="diaochu" className="lb">
                        <Input />
                    </Form.Item>
                    <Form.Item label="调入仓库" name="diaoru" className="lb">
                        <Input />
                    </Form.Item>
                    <Form.Item label="审核时间" name="shenhe" className="lb">
                        <Input />
                    </Form.Item>
                    <Form.Item label="审核状态" name="transfer" >
                        <Input />
                    </Form.Item>

                    <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
                        <Button className="btn"onClick={cancel}>
                            取消
                        </Button>
                        <Button className="btn" type="primary" htmlType="submit">
                            保存
                        </Button>
                    </Form.Item>
                </Form>
            </div>
        </div>
    );
}

export default Create;